package com.slz3.business.module.memberManagement.memPoint.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.memberManagement.memPoint.domain.MemPoint;
import com.slz3.business.module.memberManagement.memPoint.domain.MemPointFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class MemPointTransactionalServiceImpl implements MemPointTransactionalService {

    @Override
    public MemPoint modify(MemPoint memPointNew) {
        Repositorys.memPoint.test();
        Repositorys.memPoint.save(MemPointFactory.initBaseFields());
        System.err.println(1/0);
        memPointNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.memPoint.saveAndFlush(memPointNew);
    }

    @Override
    public List<MemPoint> batchModify(List<MemPoint> memPointList) {
        return Repositorys.memPoint.saveAll(memPointList);
    }
}
